Parameter undefined in method of an object